package org.example.lesson02;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;

public class les02_Demo_06 {
    public static void main(String[] args) throws IOException {
        //创建一个输入流
        FileInputStream inputStream = new FileInputStream("d:/javacode/aaa/abc.txt");
        //借助Scanner简化字符的读取操作
        Scanner in=new Scanner(inputStream,"UTF-8");
        //循环读取
        while(true){
            //是否还有下一行，如果没有循环结束，读取数据完成
            if(!in.hasNextLine()){
                break;
            }
            //获取数据
            String line=in.nextLine();
            //打印
            System.out.println(line);
        }
        //关闭in
        in.close();
        //关闭输入流
        inputStream.close();
    }
}
